package itstudio.instructor.fragment;


import itstudio.instructor.ui.LibraryActivity;
import itstudio.instructor.ui.SchoolMapActivity;
import itstudio.instructor.ui.UserListActivity;
import itstudio.instructor.widget.RippleLinearLayout;
import itstudio.instructor.widget.RippleView;

import com.easemob.chatuidemo.R;
import com.easemob.chatuidemo.activity.BaiduMapActivity;

import copy.util.Tools;
import android.content.Intent;
import android.os.Bundle;
import android.support.v4.app.Fragment;
import android.view.LayoutInflater;
import android.view.View;
import android.view.View.OnClickListener;
import android.view.ViewGroup;
import android.widget.ImageView;
import android.widget.TextView;

public class SchoolFragment extends Fragment implements OnClickListener {

    private RippleView book_borrow_tv;
    private RippleView course_tv;
    private RippleView classrom_tv;
    private RippleView map_tv;
    private RippleLinearLayout followRp;
    private View rootView ;
    @Override
    public View onCreateView(LayoutInflater inflater, ViewGroup container,
            Bundle savedInstanceState) {
        if (rootView == null) {
            rootView = inflater.inflate(R.layout.fragment_school, container,false);
            bindViews();
            init();
        }
        ViewGroup parent = (ViewGroup) rootView.getParent();
        if (parent != null) {
            parent.removeView(rootView);
        }
        return rootView;
    }
    private void bindViews() {
        book_borrow_tv = (RippleView) rootView.findViewById(R.id.book_borrow_tv);
        course_tv = (RippleView) rootView.findViewById(R.id.course_tv);
        classrom_tv = (RippleView) rootView.findViewById(R.id.classrom_tv);
        map_tv = (RippleView) rootView.findViewById(R.id.map_tv);
        followRp = (RippleLinearLayout) rootView.findViewById(R.id.follow_rp);
    }
    private void init(){
    	book_borrow_tv.setOnClickListener(this);
    	map_tv.setOnClickListener(this);
    	followRp.setOnClickListener(this);
    }
	@Override
	public void onClick(View v) {
		switch (v.getId()) {
		case R.id.book_borrow_tv:
			Tools.goActivity(getActivity(), LibraryActivity.class, null,null);
			break;
		case R.id.map_tv:
			//Tools.goActivity(getActivity(), BaiduMapActivity.class, null,null);
			Tools.goActivity(getActivity(), SchoolMapActivity.class, null,null);
			break;
		case R.id.follow_rp:
			//Tools.goActivity(getActivity(), BaiduMapActivity.class, null,null);
			Tools.goActivity(getActivity(), UserListActivity.class, null,null);
			break;

		default:
			break;
		}
	}
}
